import os
import subprocess
from  conf import conf
def work():
    config = conf.read_json()
    binNum = str(config['bucket_num'])
    base_dir = os.path.dirname(os.path.abspath(__file__)) + "/../../"
    client_dir = base_dir + "data/client/"
    exec_path = base_dir + "bin/inter.exe"
    result = subprocess.run([exec_path,
                             binNum,client_dir+"position.bin",client_dir+"t0.bin",
                             client_dir+"p.bin",client_dir+"s.bin",client_dir+"a.txt",
                             client_dir+"/result/result.txt"],  capture_output=True)
    print(result.stdout.decode('utf-8'))
    print(result.stderr.decode('utf-8'))

if __name__ == '__main__':
    work()